<template>
  <div v-if="randCurrentList">
    <el-badge
      v-for="item in pageSize"
      :key="item"
      :value="item < 10 ? '0' + item : item"
      :type="
        currentPage == item - 1
          ? 'primary'
          : checkedList[item - 1]
          ? checkedList[item - 1] ==
            JSON.parse(randList[item - 1].answers)
              .sort()
              .join('')
            ? 'success'
            : 'danger'
          : 'info'
      "
      class="item"
      @click.native="doJumpQuestion(item)"
    >
    </el-badge>
  </div>
</template>

<script>
import { mapState, mapMutations, mapGetters } from "vuex";
export default {
  data() {
    return {};
  },
  methods: {
    ...mapMutations("test", ["SET_CURRENTPAGE"]),
    doJumpQuestion(num) {
      this.SET_CURRENTPAGE(num - 1);
    },
  },
  computed: {
    ...mapState("test", ["currentPage", "pageSize", "checkedList", "randList"]),
    ...mapGetters("test", ["randCurrentList"]),
  },
};
</script>

<style scoped>
.el-badge {
  cursor: pointer;
}
</style>